projects
/
babl.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
3b21ba4
)
babl: generate db in temporary file
author
Øyvind Kolås
<pippin@gimp.org>
Tue, 31 Jan 2017 23:02:42 +0000
(
00:02
+0100)
committer
Øyvind Kolås
<pippin@gimp.org>
Tue, 31 Jan 2017 23:07:06 +0000
(
00:07
+0100)
Fixing some of - but not all race conditions shown by concurrency stress test.
babl/babl-cache.c
patch
|
blob
|
history
diff --git
a/babl/babl-cache.c
b/babl/babl-cache.c
index 723ee50d9b1d807626f51b50824173adf12c311b..5f7b71636f71f744cb4179fd348ed8a3ac943a6a 100644
(file)
--- a/
babl/babl-cache.c
+++ b/
babl/babl-cache.c
@@
-162,7
+162,11
@@
void babl_store_db (void)
{
BablDb *db = babl_fish_db ();
int i;
- FILE *dbfile = fopen (fish_cache_path (), "w");
+ char *tmpp = calloc(8000,1);
+ FILE *dbfile;
+
+ sprintf (tmpp, "%s~", fish_cache_path ());
+ dbfile = fopen (tmpp, "w");
if (!dbfile)
return;
fprintf (dbfile, "%s\n", cache_header ());
@@
-181,6
+185,9
@@
void babl_store_db (void)
fprintf (dbfile, "%s----\n", tmp);
}
fclose (dbfile);
+
+ rename (tmpp, fish_cache_path());
+ free (tmpp);
}
static int